# 导包
import requests
import app


# 创建接口类
class OrderAPI:

    # 初始化
    def __init__(self):
        self.order_list_url = "http://e.cn/api/v1/order/by_user?page=1"
        self.cate_order_url = "http://e.cn/api/v1/order"
        self.select_order_url = "http://e.cn/api/v1/order/{}"

    # 查询订单列表
    def get_order_list(self):
        return requests.get(url=self.order_list_url, headers=app.headers)

    # 创建订单
    def cate_order(self, cate_data):
        return requests.post(url=self.cate_order_url, json=cate_data, headers=app.headers)

    # 查询订单详情
    def get_order(self, order_id):
        return requests.get(url=self.select_order_url.format(order_id), headers=app.headers)





















































































































